<fieldset>
    <legend>条件搜索</legend>
    <form action="{:request()->url()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get" onsubmit="return false">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">物资编号</label>
            <div class="layui-input-inline">
                <input name="material_code" value="{:input('material_code')}" placeholder="请输入物资编号" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">物资名称</label>
            <div class="layui-input-inline">
                <input name="material_name" value="{:input('material_name')}" placeholder="请输入物资名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">物资型号</label>
            <div class="layui-input-inline">
                <input name="material_model" value="{:input('material_model')}" placeholder="请输入物资型号" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">选择汇总时间</label>
            <label class="layui-input-inline">
                <input class="layui-input" data-date-range name="enter_time" placeholder="请选择汇总时间" value="{$get.enter_time|default=''}">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">所属仓库</label>
            <label class="layui-input-inline">
                <select name="storehouse_id">
                    <option value="">- 全部 -</option>
                    {volist name="storehouse_list" id="vo"}
                    <option value="{$vo.id}">- {$vo.name} -</option>
                    {/volist}
                </select>
            </label>
        </div>
        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
            <button class="layui-btn layui-btn-primary" data-form-export="{:url('index')}?type={$type|default=''}" type="button">
                <i class="layui-icon layui-icon-export"></i> 导 出
            </button>
        </div>
    </form>
    <script>
        window.form.render();
        require(['excel'], function (excel) {
            excel.bind(function (data) {
                var items = [];
                items.push(['物资编号', '物资名称', '型号/规格', '单位', '计划价', '期初结存数量', '期初结存金额', '入库数量', '入库金额', '出库数量', '出库金额', '期末结存数量', '期末结存金额']);
                data.forEach(function (data) {
                    items.push([
                        data.material_code || '--',
                        data.material_name || '--',
                        data.material_model || '--',
                        data.material_unit || '--',
                        data.material_price || '0.00',
                        data.start_num || '--',
                        data.start_xjprice || '--',
                        data.material_num || '--',
                        data.material_xjprice || '--',
                        data.claim_num || '--',
                        data.claim_xjprice || '--',
                        data.surplus_num || '--',
                        data.surplus_xjprice || '--',
                    ]);
                });
                return items;
            }, "<?php echo $_GET['enter_time']??'';?>入库汇总");
        });
    </script>
</fieldset>
